﻿namespace Jim.OA.Service;

/// <summary>
/// 消息处理
/// </summary>
[ApiDescriptionSettings(ApplicationConst.GroupName,IgnoreApi =true)]
public  class OAMessageService : IDynamicApiController, ITransient
{
    private readonly OAClientFactory _oaClientFactory;
    public OAMessageService(OAClientFactory oaClientFactory)
    {
        _oaClientFactory = oaClientFactory;
    }

    /// <summary>
    /// OA发送消息
    /// </summary>
    /// <param name="input"></param>
    /// <remarks>需要OA里面提前配置消息类型</remarks>
    /// <returns></returns>
    [NonUnify]
    //[ApiDescriptionSettings(Name = "sendCustomMessageSingle", Order = 8599,Description ="发送消息"),HttpGet]
    public async Task<OASendMessageOutput> SendCustomMessageSingle([FromQuery]OASendMessageInput input)
    {
        var client = _oaClientFactory.CreateRestClient();
        client.IsDebug = true;
        var result = await client.Execute(input);
        return result;
    }

    /// <summary>
    /// OA修改消息
    /// </summary>
    /// <param name="input"></param>
    /// <remarks>需要OA里面提前配置消息类型</remarks>
    /// <returns></returns>
    [NonUnify]
    //[ApiDescriptionSettings(Name = "alterCustomMessageSingle", Order = 8599, Description = "修改消息"), HttpGet]
    public async Task<OAAlterMessageOutput> AlterCustomMessageSingle([FromQuery] OAAlterMessageInput input)
    {
        var client = _oaClientFactory.CreateRestClient();
        client.IsDebug = true;
        var result = await client.Execute(input);
        return result;
    }

    /// <summary>
    /// OA删除消息
    /// </summary>
    /// <param name="input"></param>
    /// <remarks>需要OA里面提前配置消息类型</remarks>
    /// <returns></returns>
    [NonUnify]
    //[ApiDescriptionSettings(Name = "deleteCustomMessageSingle", Order = 8599, Description = "删除消息"), HttpGet]
    public async Task<OADeleteMessageOutput> DeleteCustomMessageSingle([FromQuery] OADeleteMessageInput input)
    {
        var client = _oaClientFactory.CreateRestClient();
        client.IsDebug = true;
        var result = await client.Execute(input);
        return result;
    }
}
